home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Text Processing / Alpha 5.63 / Tcl / SystemCode / AlphaBits.tcl next >
Encoding:
Text File  |  1992-12-31  |  6.4 KB  |  259 lines  |  [TEXT/ALFA]

  1. if {[regexp {[]\(\)\"\{\}\[]} $HOME]} {alertnote "Alpha may not work properly if it's pathname includes parenthesis, square brackets, double quotes, or curly braces."}
  2.  
  3. proc quoteExpr str {
  4.     regsub -all {\\} $str {\\\\} str
  5.     regsub -all {\|} $str {\|} str
  6.     regsub -all {\*} $str {\\*} str
  7.     regsub -all {\+} $str {\\+} str
  8.     regsub -all {\(} $str {\\(} str
  9.     regsub -all {\)} $str {\\)} str
  10.     regsub -all {\[} $str {\\[} str
  11.     regsub -all {\]} $str {\\]} str
  12.     return $str
  13. }
  14.  
  15. proc quoteExpr2 str {
  16.     regsub -all {\\} $str {\\\\} str
  17.     regsub -all {\|} $str {\|} str
  18.     regsub -all {\*} $str {\\*} str
  19.     regsub -all {\+} $str {\\+} str
  20.     regsub -all {\(} $str {\\(} str
  21.     regsub -all {\)} $str {\\)} str
  22.     regsub -all {\{} $str "\\\{" str
  23.     regsub -all {\}} $str "\\\}" str
  24.     regsub -all {\[} $str {\\[} str
  25.     regsub -all {\]} $str {\\]} str
  26.     return $str
  27. }
  28. # Alpha 5.x Init File
  29. # Change the first number to '1' if you are using an international keyboard.
  30. init 0 2
  31. set optionIsMeta 1
  32.  
  33. source ":Tcl:SystemCode:menus.tcl"
  34.  
  35. # Examples of using C-x and C-c combinations for you emacs freaks.
  36. bind 'x' <z>     prefixChar
  37. bind 'c' <z>     prefixChar
  38. bind 'l' <X>    currentPosition
  39. bind '(' <sX>    startKeyboardMacro
  40. bind ')' <Xs>    endKeyboardMacro
  41. bind 'e' <X>    executeKeyboardMacro
  42. bind 'f' <Xz>    findFile
  43. bind 's' <Xz>    save
  44. bind 'x' <e>    execute
  45. bind 'x' <Xz>    exchangePointAndMark
  46. bind 'o' <X>    nextWindow
  47. bind 'm' <X>    matchingLines
  48.  
  49. # Another control prefix.
  50. bind 'q' <z>     prefixChar
  51. bind 'a' <Q>    shrinkHigh
  52. bind 'b' <Q>    shrinkLow
  53. bind 'c' <Q>    chooseAWindow
  54. bind 'h' <Q>    horizontally
  55. bind 'i' <Q>    iconify
  56. bind 'n' <Q>    nextWindow
  57. bind 'o' <Q>    overlay
  58. bind 'p' <Q>    prevWindow
  59. bind 's' <Q>    swapWithNext
  60. bind 't' <Q>    tiled
  61. bind 'v' <Q>    vertically
  62.  
  63.  
  64. bind 'w' <zs>    rectMarkHilite
  65. bind '\r'        carriageReturn
  66. bind '\t'         tclFileCompletion "Csh"
  67. ascii 0x1b        startEscape
  68. ascii 0x8        backSpace
  69. bind "'    '" <z>    indentLine
  70. bind 's' <zoc>    spacesToTabs
  71. bind 't' <zoc>    tabsToSpaces
  72. bind 'a' <zo>    insertAscii
  73. bind 'a' <zos>    getAscii
  74. # bind 'l' <xo>    currentPosition
  75. bind 'f' <cz>     freeMem
  76. # bind 'd' <zx>    deleteSelection
  77. # bind 'l' <x>     currentPosition
  78. bind 'r' <e>     repeatSearchBackward
  79. bind 's' <e>     repeatSearchForward
  80. bind '\ ' <e>    oneSpace
  81. bind 'j' <e>    fillRegion
  82. bind 'p' <e>    fillParagraph
  83. bind 'b' <e>     backwardWord
  84. bind 'b' <es>    backwardWordSelect
  85. bind 'd' <e>     deleteWord
  86. bind 'f' <e>     forwardWord
  87. bind 'f' <es>     forwardWordSelect
  88. bind 'g' <e>     gotoLine
  89. bind 'h' <e>     backwardDeleteWord
  90. bind '<' <se>     beginningOfBuffer
  91. bind '>' <se>     endOfBuffer
  92. bind 't' <e>     findTag
  93. bind 'k' <e>     keyCode
  94. bind 'l' <e>    downcaseWord
  95. bind 'u' <e>    upcaseWord
  96. bind 'c' <e>    capitalizeWord
  97. bind 'e' <e>     nextSentence
  98. bind 'a' <o>     prevSentence
  99.  
  100. bind Left  backwardChar
  101. bind Left <c> beginningOfLine
  102. bind Left <s> backwardCharSelect
  103. bind Left <sc> beginningLineSelect
  104. bind Left <z> {scrollLeftCol 15}
  105. bind Left <o> backwardWord
  106. bind Left <os> backwardWordSelect
  107.  
  108. bind Right  forwardChar
  109. bind Right <c> endOfLine
  110. bind Right <s> forwardCharSelect
  111. bind Right <sc> endLineSelect
  112. bind Right <z> {scrollRightCol 15}
  113. bind Right <o> forwardWord
  114. bind Right <os> forwardWordSelect
  115.  
  116. bind Up  previousLine
  117. bind Up <s> prevLineSelect
  118. bind Up <c> beginningOfBuffer
  119. bind Up <sc> beginningBufferSelect
  120. bind Up <z> scrollUpLine
  121. bind Up <o> scrollUpLine
  122.  
  123. bind Down  nextLine
  124. bind Down <c> endOfBuffer
  125. bind Down <s> nextLineSelect
  126. bind Down <sc> endBufferSelect
  127. bind Down <z> scrollDownLine
  128. bind Down <o> scrollDownLine
  129.  
  130. # Keypad definitions
  131. bind KPad4  backwardWord                 
  132. bind KPad4   <c> backwardDeleteWord 
  133. bind KPad6   forwardWord                 
  134. bind KPad6   <c> deleteWord 
  135. bind Clear   insertToTop                 
  136. # Never bind Keypad /
  137. # Never bind Keypad *
  138. bind KPad0   pageBack                     
  139. bind Enter   pageForward
  140. ;bind KPad3   repeatSearchForward         
  141. ;bind KPad1   repeatSearchBackward     
  142. bind Kpad1 prevFunc
  143. bind Kpad3 nextFunc
  144. bind KPad.   endOfBuffer                 
  145. bind KPad5   exchangePointAndMark     
  146. bind KPad7   backwardDeleteWord         
  147. bind KPad9   deleteWord                 
  148. bind 's' <z>     isearch            
  149. bind 'r' <z>     rsearch            
  150. bind 'a' <z>     beginningOfLine    
  151. bind 'b' <z>     backwardChar        
  152. bind 'd' <z>     deleteChar        
  153. bind 'f' <z>     forwardChar        
  154. bind 'e' <z>     endOfLine        
  155. bind 'g' <z>     abortEm            
  156. bind 'k' <z>     killLine            
  157. bind 'l' <z>    centerRedraw
  158. bind 't' <z>     insertToTop        
  159. bind 'p' <z>     previousLine        
  160. bind 'n' <z>     nextLine            
  161. bind 'o' <z>     openLine            
  162. bind 'u' <z>     iterationCount    
  163. bind 'v' <z>     pageForward        
  164. bind 'v' <e>     pageBack
  165. bind 'z' <z>     pageBack
  166. bind 'w' <z>     cut            
  167. bind 'w' <e>     copy
  168. bind "' '" <z>     setMark            
  169. bind 'y' <z>     yank                
  170.  
  171. # Alpha variable and flag definitions.
  172. set temp [getMainDevice]
  173. set tileWidth [expr {[lindex $temp 2] - [lindex $temp 0] - 10}]
  174. if {$tileWidth > 510} {set defWidth 510} else {set defWidth $tileWidth }
  175. set tileHeight [expr {[lindex $temp 3] - [lindex $temp 1] - 45}]
  176. set defHeight $tileHeight
  177. unset temp
  178.  
  179. source ":Tcl:SystemCode:definitions.tcl"
  180.  
  181.  
  182. # Color support
  183. # colors -20481 2703 2703 -632 -588 -11060
  184. colors 0 0 0 -588 -818 -1507
  185.  
  186. bind F1     iconify                     
  187. bind F2     cut                         
  188. bind F3     copy                         
  189. bind F4     yank                         
  190. bind F5     prevWindow
  191. bind F6        nextWindow
  192. bind F7        tiled
  193. bind F8        swapWithNext
  194. bind F9     pushMark
  195. bind F10    popMark
  196. bind F11    shrinkHigh
  197. bind F12    shrinkLow
  198. bind F13    startKeyboardMacro         
  199. bind F14    endKeyboardMacro             
  200. bind F15    executeKeyboardMacro         
  201.  
  202. bind Del    deleteChar                 
  203. bind Help   alphaHelp                     
  204. bind Home   beginningOfBuffer             
  205. bind End    endOfBuffer                 
  206. bind Pgup   pageBack                     
  207. bind Pgdn   pageForward                  
  208.  
  209. proc debug {} {
  210.     uplevel #0 {
  211.         set debugging 1
  212.         shadowVar debugging
  213.     }
  214. }
  215.  
  216. proc editFlag {menu item} {
  217.     global $item
  218.     set val [expr ([set $item]-1)*-1]
  219.     set $item $val
  220. }
  221.  
  222. proc editVar {menu item} {
  223.     global $item
  224.     append prmpt "New Value of " $item ": "
  225.     if ![catch {prompt $prmpt [set $item]} res] {
  226.         set $item $res
  227.     }
  228. }
  229.  
  230. # Load electric alias, rebind tcl file completion for precedence.
  231. proc loadElectricAlias {} {
  232.     global HOME
  233.     uplevel #0 {
  234.         source "$HOME:Tcl:ElectricAlias:electricAlias.tcl"
  235.     }
  236.     message "ElectricAlias loaded."
  237.     bind '\t' tclFileCompletion "Csh"
  238.     enableMenuItem Misc loadElectricAlias off
  239. }
  240.  
  241. menu -n Tcl {
  242.     "traceTclProc"
  243. }
  244.  
  245.  
  246. source ":Tcl:SystemCode:flags.tcl"
  247. source ":Tcl:SystemCode:filesets.tcl"
  248. source ":Tcl:SystemCode:procs.tcl"
  249. source ":Tcl:SystemCode:copyRing.tcl"
  250. set auto_path [list $HOME:Tcl:SystemCode $HOME:Tcl:UserCode]
  251. source ":Tcl:SystemCode:library.tcl"
  252.  
  253.  
  254. # Use "userStartup.tcl" to define or change any tcl information. */
  255. if {[file exists ":userStartup.tcl"]} {
  256.     source  ":userStartup.tcl"
  257. }
  258.  
  259.